package org.smartboot.flow.testcase.reload;

import org.smartboot.flow.manager.reload.XmlSelector;
import org.springframework.stereotype.Service;

/**
 * @author huqiang
 * @since 2022/12/7 19:54
 */
@Service
public class MockXmlSelector implements XmlSelector {

    @Override
    public String select(String engineName) {
        return "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
                "<engines xmlns=\"http://org.smartboot/smart-flow\"\n" +
                "       xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
                "       xsi:schemaLocation=\"http://org.smartboot/smart-flow\n" +
                "                           http://org.smartboot/smart-flow-1.0.1.xsd\">\n" +
                "\n" +
                "\n" +
                "    <engine name=\"testEngine\" pipeline=\"subprocess1\"/>\n" +
                "\n" +
                "    <pipeline name=\"subprocess1\">\n" +
                "        <component execute=\"org.smartboot.flow.testcase.step.Step1\" name=\"step1\"/>\n" +
                "        <component execute=\"org.smartboot.flow.testcase.step.Step2\" name=\"step2\"/>\n" +
                "        <pipeline name=\"subprocess2\">\n" +
                "            <component execute=\"org.smartboot.flow.testcase.step.Step3\" name=\"step3\"/>\n" +
                "            <component execute=\"org.smartboot.flow.testcase.step.Step4\" name=\"step4\"/>\n" +
                "        </pipeline>\n" +
                "\n" +
                "        <if test=\"org.smartboot.flow.testcase.condition.AlwaysTrueCondition\">\n" +
                "            <then>\n" +
                "                <component execute=\"org.smartboot.flow.testcase.step.Step7\" name=\"step5\"/>\n" +
                "                <component execute=\"org.smartboot.flow.testcase.step.Step8\" name=\"step6\"/>\n" +
                "                <pipeline name=\"subprocess3\">\n" +
                "                    <if test=\"org.smartboot.flow.testcase.condition.AlwaysTrueCondition\">\n" +
                "                        <then execute=\"org.smartboot.flow.testcase.step.Step1\" name=\"step7\"/>\n" +
                "                    </if>\n" +
                "                    <component execute=\"org.smartboot.flow.testcase.step.Step1\" name=\"step8\"/>\n" +
                "                </pipeline>\n" +
                "\n" +
                "            </then>\n" +
                "            <else execute=\"org.smartboot.flow.testcase.step.Step6\" name=\"default\"/>\n" +
                "        </if>\n" +
                "\n" +
                "        <choose test=\"org.smartboot.flow.testcase.condition.RequestChooseCondition\">\n" +
                "            <case when=\"1\" execute=\"org.smartboot.flow.testcase.step.Step7\"/>\n" +
                "            <case when=\"null\" execute=\"org.smartboot.flow.testcase.step.Step8\"/>\n" +
                "            <default execute=\"org.smartboot.flow.testcase.step.Step1\"/>\n" +
                "        </choose>\n" +
                "\n" +
                "    </pipeline>\n" +
                "</engines>";
    }
}
